<template>
  <div>
    <el-row>
      <el-col :span="24" id="GoodsOrder1">
        <div style="height: 20px;"></div>
        <el-table :data="filteredRecords" border>
          <el-table-column prop="venueName" label="场馆名" width="100"></el-table-column>
          <el-table-column prop="recruitTitle" label="招聘标题" width="230"></el-table-column>
          <el-table-column prop="recruitMessage" label="招聘信息" width="630"></el-table-column>
          <el-table-column prop="recruitSalary" label="招聘工资" width="130"></el-table-column>
          <el-table-column prop="recruitState" label="招聘状态" width="230">
            <template slot-scope="records">
              <template v-if="records.row.recruitState == 1">
                正在招聘
              </template>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.pageNum" :page-sizes="[1, 2, 3, 4]" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total"></el-pagination>
      </el-col>
    </el-row>
  </div>
</template>
<script>
export default {
  name: "venueAllRecruit",
  data() {
    return {
      page: {},
      goodsList: [],
      param: {
        pageNum: 1,
        pageSize: 5 // 每页显示5个商品
      }
    };
  },
  computed: {
    filteredRecords() {
      // 过滤掉 recruitState == 0 的记录
      return this.page.records ? this.page.records.filter(record => record.recruitState != 0) : [];
    }
  },
  methods: {
    // 分页
    handleCurrentChange(val) {
      this.param.pageNum = val;
      this.loadAllGoods();
    },
    handleSizeChange(val) {
      this.param.pageSize = val;
      this.loadAllGoods();
    },
    // 分页查询
    loadAllGoods() {
      this.$http.get("/venue/yRecruit/pageAllRecruit", {
        params: {
          pageNum: this.param.pageNum,
          pageSize: this.param.pageSize
        }
      }).then(resp => {
        this.page = resp.data.data;
        this.goodsList = this.page.records;
      });
    }
  },
  created() {
    this.loadAllGoods();
  }
};
</script>
<style>
#GoodsOrder2 {
  margin-left: -520px;
  line-height: 100%;
  width: 100%;
}

#GoodsOrder1 {
  line-height: 100%;
  width: 100%;
}
</style>
